#pragma once
#define qDb (Connection::Instance())
#include <QSqlDatabase>
#include <QSqlQueryModel>
#include <QStandardItemModel>
#include <QStringListModel>
#include "MQSortFilterProxyModel.h"
enum BkIndex//枚举书籍序号
{
  BkId=0,
  BkName=1,
  BkAuthor=2,
  BkPub=3,
  BkPubDate=4,
  BkAvail=5,
  BkStore=6,
  BkTotal=7,
  BkPrice=8
};

enum LnIndex//枚举书籍序号
{
  LnUser,
  LnBookID,
  LnBookName,
  LnLDate,
  LnRDate,
};

enum Page{
  BookPage,
  LoanPage,
  UserPage,
  ManaPage,
  NonePage
};

extern Page page;
extern MQSortFilterProxyModel *proxyModel;
extern QSqlQueryModel *bookModel;
extern QSqlQueryModel *loanModel;
extern QSqlQueryModel *userModel;
extern QStandardItemModel *temp;

extern QStringListModel *cmbModel;

extern

void setBookHeaderData(QAbstractItemModel *model);
void setLoanHeaderData(QAbstractItemModel *model);


class Connection
{
 public:
  static Connection *Instance();
  void setDataBase();
  QSqlDatabase db;

 private:
  explicit Connection();
  static Connection *self;

};

